package com.flx.dis.sharding.service.impl;

import com.flx.dis.sharding.dao.WorkDao;
import com.flx.dis.sharding.entity.Work;
import com.flx.dis.sharding.service.WorkService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author: Fenglixiong
 * @Date: 2021/6/9 17:57
 * @Description:
 */
@Slf4j
@Service
public class WorkServiceImpl implements WorkService {

    @Autowired
    private WorkDao workDao;

    @Override
    @Transactional
    public Long add(Work work) {
        workDao.insert(work);
        log.info("add success id = "+work.getId());
        return work.getId();
    }

    @Override
    public Work get(Long id) {
        return workDao.selectById(id);
    }
}
